package com.hzhr.iot.device.controller;

import com.hzhr.iot.core.annotation.ApiImplicitInternalParams;
import com.hzhr.iot.core.annotation.Author;
import com.hzhr.iot.core.exception.ServiceException;
import com.hzhr.iot.device.controller.base.BaseController;
import com.hzhr.iot.device.model.iotDevice_key.IotDevice_KeyGetModel;
import com.hzhr.iot.device.service.IotDevice_KeyService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;

@Api(tags = "IotDevice_Key", description = "物联网设备的密钥")
@RestController
@RequestMapping(value = "")
public class IotDevice_KeyController extends BaseController {
    @Autowired
    IotDevice_KeyService iotDevice_keyService;

    //region /iot-devices/{iotDeviceId}/keys GET
    //region swagger响应码 : getByIotDeviceId
    @ApiResponses({
            @ApiResponse(code = 200, message = "成功"),
    })
    //endregion
    //region swagger说明 : getByIotDeviceId
    @ApiOperation(value="查询物联网设备的密钥", notes="查询物联网设备的密钥  \n简介 : 查询物联网设备的密钥  \n步骤 :  \n1. 查询物联网设备 : (√)  \n 根据路径参数iotDeviceId查询物联网设备(COLLECT_DEVICE)iotDevice_1，筛选规则：iotDevice_1.id = iotDeviceId；  \n2. 返回信息 : (√)  \n 根据条件参数和collectDevice_1组装响应并返回；  \n",produces = "application/json")
    //endregion
    //region swagger参数 : getByIotDeviceId
    @ApiImplicitParams({
            @ApiImplicitParam(name = "token", value = "令牌",required = true, dataType = "string", paramType = "header"),

            @ApiImplicitParam(name = "iotDeviceId", value = "物联网设备编号",required = true, dataType = "int", paramType = "path"),

            @ApiImplicitParam(name = "show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),

    })
    @ApiImplicitInternalParams({
            @ApiImplicitParam(name = "_token", value = "令牌",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-id", value = "用户编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-code", value = "用户代码",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-name", value = "用户名",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-company-id", value = "公司编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-dept-id", value = "部门编号",required = true, dataType = "int", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-user-type", value = "用户类型(关联: common_service.options.code, typeCode = 'USER_TYPE')",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-id", value = "交易流水号",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-transaction-type", value = "交易类型",required = true, dataType = "string", paramType = "header"),
            @ApiImplicitParam(name = "_hzhr-access-mode", value = "访问模式 0:一般 1:全局",defaultValue = "0", required = false, dataType = "int", paramType = "header"),

            @ApiImplicitParam(name = "_show", value = "展示形式 one:展示一个,list:展示列表,null(空值):不展示", required = false, dataType = "string", paramType = "query"),

    })
    //endregion
    //region 请求 : getByIotDeviceId
    @RequestMapping(value = "/iot-devices/{iotDeviceId}/keys", method = RequestMethod.GET)
    //endregion
    @Author
    public ResponseEntity<IotDevice_KeyGetModel> getByIotDeviceId(@PathVariable("iotDeviceId") Integer iotDeviceId,
                                                                  @RequestParam @ApiIgnore Map<String, Object> query) throws ServiceException {
        IotDevice_KeyGetModel responseBody = iotDevice_keyService.getByIotDeviceId(initHeader(), iotDeviceId, query);
        return new ResponseEntity<>(responseBody, HttpStatus.OK);
        //endregion
    }
    //endregion
}














































































































































































































































































































































































































































































































































































































































































